package com.ruoyi.back.controller

import com.ruoyi.app.common.Data
import com.ruoyi.app.common.PageData
import com.ruoyi.back.domain.TemplateCategory
import com.ruoyi.back.service.TemplateCategoryService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.PathVariable
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestBody
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("system/templateCategory")
@Api(tags = ["模板分类"])
class TemplateCategoryController {

    @Autowired
    private lateinit var templateCategoryService: TemplateCategoryService


    @ApiOperation("保存模板分类")
    @PostMapping("save")
    fun saveTemplateCategory(@RequestBody templateCategory: TemplateCategory): Data<Boolean> =
        templateCategoryService.saveTemplateCategory(templateCategory)

    @ApiOperation("模板分类分页")
    @GetMapping("page")
    fun templateCategoryPage(templateCategory: TemplateCategory): PageData<TemplateCategory> =
        templateCategoryService.templateCategoryPage(templateCategory)

    @ApiOperation("移除模板分类")
    @GetMapping("remove/{ids}")
    fun removeTemplateCategory(@PathVariable ids: String): Data<Boolean> =
        templateCategoryService.removeTemplateCategory(ids)
}